<template>
<div id="app">
  <el-input v-model="input" placeholder="请输入内容" style="width: 200px"></el-input><el-button type="primary" @click="search">搜索</el-button>
  <!--表格-->
  <el-table
    :data="tableData"
    border
    style="width: 100%">
    <el-table-column
      fixed
      prop="Member_ID"
      label="编号"
      width="240">
    </el-table-column>
    <el-table-column
      prop="Member_Name"
      label="姓名"
      width="240">
    </el-table-column>
    <el-table-column
      prop="Member_Phone"
      label="电话"
      width="200">
    </el-table-column>
    <el-table-column
      prop="Member_Address"
      label="住址"
      width="400">
    </el-table-column>
    <el-table-column
      fixed="right"
      label="操作"
      width="500">
      <template slot-scope="scope">
        <el-button @click="memberDel(scope.row)" type="text" size="small">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
  <el-pagination
    @current-change="handleCurrentChange"
    style="margin-left: 550px;margin-top: 20px"
    background
    layout="prev, pager, next"
    :total="300"
  >
  </el-pagination>
</div>
</template>

<script>
  export default {
    methods: {
      memberDel(row) {
        this.axios.delete("/api/member/"+row.Member_ID).then(alert("删除成功！"))
      }, handleCurrentChange: function(currentPage){
        this.currentPage = currentPage;
        this.handleUserList();
      },handleUserList(){
        this.axios.get("/api/member/"+((this.currentPage-1)*13)).then(res => {this.tableData=res.data})
      }
      ,search(){
        this.axios.get("/api/search/"+this.input).then(res => {this.tableData=res.data})
      }
    },
    data() {
      return {
        input:"",
        tableData:[],
        currentPage:1,
        pageSize:10,
      }
    }
    ,created() {
        this.handleUserList()
    }
  }
</script>

<style scoped>

</style>
